package com.seetools.generator.config;

import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;

/**
 * @Author: seeTools
 * @Date: 2023/5/18  17:39
 * @Version 1.0
 */
public class StrategyInitConfig {

    /**
     * 实体类继承的父类
     */
    private static final String BASE_ENTITY = "com.ztools.common.model.pc.BaseModel";

    public static StrategyConfig strategyInit(String tableName) {
        StrategyConfig config = new StrategyConfig();
        config.setNaming(NamingStrategy.underline_to_camel);
        config.setColumnNaming(NamingStrategy.underline_to_camel);
        // 自动lombok
        config.setEntityLombokModel(true);
        config.setRestControllerStyle(true);
        config.setControllerMappingHyphenStyle(true);
        config.setSuperEntityClass(BASE_ENTITY);
        config.entityTableFieldAnnotationEnable(true);
        config.setEntityBuilderModel(true);
        config.setInclude(tableName);
        config.setNaming(NamingStrategy.underline_to_camel);
        return config;
    }

}
